3 # Copyright 2011 Paul Haensch
4 # This file is part of Busy
6 # Busy is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # Busy is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with Busy. If not, see <http://www.gnu.org/licenses/>.
20 alias _wiki="stx2any --no-template --link-abbrevs --quote -T html"
22 page=$(egrep -o '(^|&)p=[a-zA-Z0-9/_-]+(&|$)' <<<"${QUERY_STRING}" |sed 's,&,,g;s,p=,,')
24 [ -z "$LOGIN" ] && LOGIN=false
25 [ -z "$DEV" ] && DEV=false
26 [ -z "$ADM" ] && ADM=false
27 [ -z "$page" ] && page=Home
29 if (! $LOGIN && egrep -qx "https?://${HTTP_HOST}/(session.cgi\?|write/).*" <<<"${HTTP_REFERER}"); then
30 echo -n "Location: http://${HTTP_HOST}/session.cgi?${QUERY_STRING}\n\n"
34 echo -n "Content-type: text/html\n\n"
38 <!-- DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd" -->
43 <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
44 <link rel="stylesheet" type="text/css" href="busy.css">
45 <link rel="stylesheet" type="text/css" href="wikitext.css">
46 $([ -r "${page}.css" ] && echo '<link rel="stylesheet" type="text/css" href="'"$page"'.css">')
47 <style type="text/css"><!-- --></style>
48 <script type="text/javascript">
50 function show_screen(id){
51 document.getElementById(id).style.display = "inline";
53 function hide_screen(id){
54 document.getElementById(id).style.display = "none";
59 <body onload="init();">
61 <h1 id="NAME">$(egrep '^name=.*$' project.meta |cut -d= -f2-)</h1>
62 <span id="SLOGAN">$(egrep '^slogan=.*$' project.meta |cut -d= -f2-)</span>
65 $( $LOGIN || echo '<form action="/login.cgi?'${QUERY_STRING:gs/&/&/}'" method="post" accept-charset="UTF-8">
67 <input type="text" name="user" value placeholder="Username"><br>
68 <input type="password" name="pass" value placeholder="Password"><br>
69 <input type="submit" value="Go!">
75 <a href='/?p=Home'>Home</a>
76 <a href='/?p=Wiki'>Wiki</a>
77 <a href='/?p=Subversion'>Code</a>
78 <a href='/?p=Tasks'>Tasks</a>
80 $(if [ -r "./${page}.page" ]; then
83 echo '<h2>Page not found or nevermore</h2>'
84 echo 'Quoth the Raven: 404'